<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/09/0009
 * Time: 10:50
 */

namespace app\sports_admin\service;

use app\sports_admin\model\School as SchoolModel;
use app\sports_admin\model\Teacher as TeacherModel;
use app\sports_admin\model\Student as StudentModel;
use app\sports_admin\model\Parents as ParentsModel;
use app\sports_admin\model\Suggestion as SuggestionModel;
class Statistics
{
    public static function count()
    {
        $input['school'] = self::schoolCount();
        $input['teacher'] = self::teacherCount();
        $input['student'] = self::studentCount();
        $input['users'] = self::usersCount();
        $input['article'] = self::articleCount();
        return json($input);
    }
    /*
     * 统计学校总数
     */
    private static function schoolCount()
    {
        return (new SchoolModel())->count();
    }
    /*
     * 统计教师总数
     */
    private static function teacherCount()
    {
        return (new TeacherModel())->count();
    }
    /*
     * 统计学生总数
     */
    private static function studentCount()
    {
        return (new StudentModel())->count();
    }
    /*
     * 统计用户总数
     */
    private static function usersCount()
    {
        return (new ParentsModel())->count();
    }
    /*
     * 统计文章总数
     */
    private static function articleCount()
    {
        return (new SuggestionModel())->count();
    }
}